import { ADD_COMMENT, DEL_COMMENT, RECEIVE_COMMENTS } from './action-types';
export const addComment = function (comment) {
	return {
		type: ADD_COMMENT,
		data: comment
	}
}
export const delComment = function (index) {
	return {
		type: DEL_COMMENT,
		data: index
	}
}

const receiveComments = function (comments) {
	return {
		type: RECEIVE_COMMENTS,
		data: comments
	}
}

export const getComments = () => dispatch => (
	setTimeout(() => {
		const initComments = [
			{
				username: "Tom",
				content: "react测试"
			},
			{
				username: "Jack",
				content: "vue可以吗"
			}
		]
		dispatch(receiveComments(initComments))
	}, 2000)
)